﻿using FieldTools.Client.Business.IBusiness;
using FieldTools.Client.Entity.OneBot;
using FieldTools.Util;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;

namespace FieldTools.Client.Controllers
{
    [ApiController]
    [Route("/[controller]/[action]")]
    public class TestController : ControllerBase
    {
        private readonly ILogger<TestController> _logger;
        private readonly ITestBus _testBus;
        public TestController(ILogger<TestController> logger, ITestBus testBus)
        {
            _logger = logger;
            _testBus = testBus;
        }

        [HttpGet]
        public string GetTest()
        {
            _logger.LogError("调用了一次测试get");
            _logger.LogWarning("调用了一次测试get");
            return "get调用成功";
        }

        [HttpPost]
        public string PostTest()
        {
            _logger.LogError("调用了一次测试post");
            _logger.LogWarning("调用了一次测试post");
            return "post调用成功";
        }


        [HttpPost]
        public string PostTest2()
        {
            return _testBus.Func1();
        }
    }
}
